﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPNETPerformance.App_BusinessLogic.BasePages;
using ASPNETPerformance.App_BusinessLogic.Helpers;
using ASPNETPerformance.App_BusinessLogic.SEO;
using ASPNETPerformance.App_BusinessLogic.Utils;

namespace ASPNETPerformance._02_JsAndCss {
    public partial class Combine : BasePage {
        protected void Page_Load( object sender, EventArgs e ) {

        }

        protected override void OnPreRender( EventArgs e ) {
            if ( CommonHelper.GetCookieBool( "IsCombine" ) ) {
                if ( File.Exists( HttpContext.Current.Request.PhysicalApplicationPath + "_assets\\css\\Combine.all.css" ) ) {
                    SEOHelper.AddStylesheetInclude( this, "~/_assets/css/Combine.all.css" );
                }
                else {
                    BindCss();
                }
                if ( File.Exists( HttpContext.Current.Request.PhysicalApplicationPath + "_assets\\js\\Combine.all.js" ) ) {
                    SEOHelper.AddJavaScriptInclude( this, "~/_assets/js/Combine.all.js" );
                }
                else {
                    BindJs();
                }
            }
            else {
                base.OnPreRender( e );
            }
        }
    }
}